package com.cms.model;


import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 * 权限�?
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_Permission")
public class Permission implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3920523629540268618L;

	public static final int C  =  1;
	
	public static final int R  =  2;
	
	public static final int U  =  4;
	
	public static final int D  =  8;
	
	
	/*
	 * 数据库Id
	 */
	@Id
	@GeneratedValue(strategy =GenerationType.AUTO)
	private int id;
	/*
	 * 模块id
	 */
	@Column
	private int resource;
	/*
	 * 访问权限
	 */
	@Column
	private int acl;
	/*
	 * 权限对应角色
	 */
	
	@ManyToOne(cascade = CascadeType.ALL)
	private Role role;
	/*
	 * 角色id
	 */
	//@Column
	//private int roleid;
	
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}
	
	public int getResource() {
		return resource;
	}
	
	public void setResource(int resource) {
		this.resource = resource;
	}
	
	public int getAcl() {
		return acl;
	}
	
	public void setAcl(int acl) {
		this.acl = acl;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
	
}
